import React from "react";
import { Navigate } from "react-router-dom";
import { RouteRawState } from "../types";
import {
  ConsultationChat,
  ConsultationCommentList,
  ConsultationDetail,
  ConsultationList,
  HomeIndex,
  HomeInformation,
  HomeInformationDetail,
  HomeKnowledgeBase,
  HomeKnowledgeBaseDetail,
  HomeSearch,
  My,
  MyAddModifyProFile,
  MyAdoptIdea,
  MyAttention,
  MyCollection,
  MyConsultationComment,
  MyConsultationCurrent,
  MyConsultationHistory,
  MyConsultationQueryComment,
  MyConsultationResult,
  MyForgetPassword1,
  MyForgetPassword2,
  MyLogin,
  MyMessage,
  MyMessageDetail,
  MyPatientCircle,
  MyPatientCircleCommentList,
  MyPayVideo,
  MyProFile,
  MyRegister,
  MySign,
  MyVideo,
  MyWallet,
  PatientCircle,
  PatientCircleDetail,
  PatientCircleSearch,
  PatientCircleSearchResult,
  PatientCircleUserInfo,
  PatientCircleWrite,
  PersonInfomation,
  Recharge,
  RechargeSuccess,
  Set,
  SetBindBankCard,
  SetBindConfirm,
  SetChangePassword,
  SetChooseGender,
  SetInviteFriends,
  SetMyPhysicalSigns,
  SetNickname,
  SetRealNameAuthentication,
  SetScreenBrightness,
  SetVersionDetection,
  SetViewBankCards,
  ViewAuthenticationInformation,
  Withdrawal,
  WithdrawalRecords,
  Withdrawaling,
} from "./router";
import { KeepAliveProvider } from "../components";

/************************ 首页 *********************************/

export const HomeRoutes: RouteRawState[] = [
  {
    path: "/home",
    element: <KeepAliveProvider>
      <HomeIndex></HomeIndex>
    </KeepAliveProvider>,
    meta: {
      title: "首页",
      cache: true
    },
  },
  {
    path: "/home/search",
    element: <HomeSearch></HomeSearch>,
    meta: {
      title: "搜索",
    },
  },
  {
    path: "/home/knowledgebase",
    element: <HomeKnowledgeBase></HomeKnowledgeBase>,
    meta: {
      title: "知识库",
    },
  },
  {
    path: "/home/knowledgebase/:id/:type",
    element: <HomeKnowledgeBaseDetail></HomeKnowledgeBaseDetail>,
    meta: {
      title: "知识库-详情",
    },
  },
  {
    path: "/home/information",
    element: <HomeInformation></HomeInformation>,
    meta: {
      title: "咨询",
    },
  },
  {
    path: "/home/information/:infoId",
    element: <HomeInformationDetail></HomeInformationDetail>,
    meta: {
      title: "咨询详情",
    },
  },
  {
    path: "/",
    element: <Navigate to="/home"></Navigate>,
    meta: {
      title: "首页",
    },
  },
];

/************************ 问诊 *********************************/

export const consultationRoutes: RouteRawState[] = [
  {
    path: "/consultation/doctor/list",
    element: <ConsultationList></ConsultationList>,
    meta: {
      title: "医生列表",
    },
  },
  {
    path: "/consultation/chat",
    element: <ConsultationChat></ConsultationChat>,
    meta: {
      title: "聊天对话-聊天记录",
    },
  },
  {
    path: "/consultation/doctor/detail",
    element: <ConsultationDetail></ConsultationDetail>,
    meta: {
      title: "医生详情",
    },
  },
  {
    path: "/consultation/comment/list",
    element: <ConsultationCommentList></ConsultationCommentList>,
    meta: {
      title: "评论列表",
    },
  },
  {
    path: "/consultation/my/current",
    element: <MyConsultationCurrent></MyConsultationCurrent>,
    meta: {
      title: "当前问诊",
    },
  },
  {
    path: "/consultation/my/history",
    element: <MyConsultationHistory></MyConsultationHistory>,
    meta: {
      title: "历史问诊",
    },
  },
  {
    path: "/consultation/my/comment",
    element: <MyConsultationComment></MyConsultationComment>,
    meta: {
      title: "评价问诊",
    },
  },
  {
    path: "/consultation/my/result",
    element: <MyConsultationResult></MyConsultationResult>,
    meta: {
      title: "评价结果",
    },
  },
  {
    path: "/consultation/my/query/comment",
    element: <MyConsultationQueryComment></MyConsultationQueryComment>,
    meta: {
      title: "查看评价",
    },
  },
];

/************************ 钱包 *********************************/

export const walletRoutes: RouteRawState[] = [
  {
    path: "/wallet/my",
    element: <MyWallet></MyWallet>,
    meta: {
      title: "我的钱包",
    },
  },
  {
    path: "/wallet/recharge",
    element: <Recharge></Recharge>,
    meta: {
      title: "钱包充值",
    },
  },
  {
    path: "/wallet/recharge/success",
    element: <RechargeSuccess></RechargeSuccess>,
    meta: {
      title: "充值成功",
    },
  },
  {
    path: "/wallet/withdrawal",
    element: <Withdrawal></Withdrawal>,
    meta: {
      title: "钱包提现",
    },
  },
  {
    path: "/wallet/withdrawaling",
    element: <Withdrawaling></Withdrawaling>,
    meta: {
      title: "提现中",
    },
  },
  {
    path: "/wallet/withdrawal/records",
    element: <WithdrawalRecords></WithdrawalRecords>,
    meta: {
      title: "提现记录",
    },
  },
];
/************************ 病友圈 *********************************/

export const patientCircleRoutes: RouteRawState[] = [
  {
    path: "/patient/circle",
    element: <PatientCircle></PatientCircle>,
    meta: {
      title: "病友圈首页",
    },
  },
  {
    path: "/patient/circle/detail",
    element: <PatientCircleDetail></PatientCircleDetail>,
    meta: {
      title: "病友圈详情页",
    },
  },
  {
    path: "/patient/circle/search",
    element: <PatientCircleSearch></PatientCircleSearch>,
    meta: {
      title: "病友圈搜索",
    },
  },
  {
    path: "/patient/circle/search/result",
    element: <PatientCircleSearchResult></PatientCircleSearchResult>,
    meta: {
      title: "病友圈搜索结果",
    },
  },
  {
    path: "/patient/circle/user/info/:patientUserId",
    element: <PatientCircleUserInfo></PatientCircleUserInfo>,
    meta: {
      title: "病友圈用户信息页",
    },
  },
  {
    path: "/patient/circle/write",
    element: <PatientCircleWrite></PatientCircleWrite>,
    meta: {
      title: "写病友圈",
    },
  },
];

/************************ 视频 *********************************/
export const VideoRoutes: RouteRawState[] = [
  {
    path: "/vedio",
    element: <MyVideo></MyVideo>,
    meta: {
      title: "视频",
    },
  },
];

/************************  我的 *********************************/

export const MyRoutes: RouteRawState[] = [
  {
    path: "/my/pay/video",
    element: <MyPayVideo></MyPayVideo>,
    meta: {
      title: "购买的视频",
    },
  },
  {
    path: "/my/adopt/idea",
    element: <MyAdoptIdea></MyAdoptIdea>,
    meta: {
      title: "采纳意见",
    },
  },
  {
    path: "/login",
    element: <MyLogin></MyLogin>,
    meta: {
      title: "登录",
    },
  },
  {
    path: "/my/forget/password1",
    element: <MyForgetPassword1></MyForgetPassword1>,
    meta: {
      title: "忘记密码1",
    },
  },
  {
    path: "/my/forget/password2",
    element: <MyForgetPassword2></MyForgetPassword2>,
    meta: {
      title: "忘记密码2",
    },
  },
  {
    path: "/register",
    element: <MyRegister></MyRegister>,
    meta: {
      title: "注册",
    },
  },
  {
    path: "/my/patient/circle",
    element: <MyPatientCircle></MyPatientCircle>,
    meta: {
      title: "我的病友圈",
    },
  },
  {
    path: "/my/patient/circle/comment/list",
    element: <MyPatientCircleCommentList></MyPatientCircleCommentList>,
    meta: {
      title: "病友圈评论列表",
    },
  },
  {
    path: "/my",
    element: <My></My>,
    meta: {
      title: "我的",
      cache: true
    },
  },
  {
    path: "/my/sign",
    element: <MySign></MySign>,
    meta: {
      title: "我的签到",
    },
  },
  {
    path: "/my/profile",
    element: <MyProFile></MyProFile>,
    meta: {
      title: "我的档案",
    },
  },
  {
    path: "/my/profile/edit_add",
    element: <MyAddModifyProFile></MyAddModifyProFile>,
    meta: {
      title: "编辑-添加-档案",
    },
  },
  {
    path: "/my/attention",
    element: <MyAttention></MyAttention>,
    meta: {
      title: "我的关注",
    },
  },
  {
    path: "/my/collection",
    element: <MyCollection></MyCollection>,
    meta: {
      title: "我的收藏",
    },
  },
  {
    path: "/my/message",
    element: <MyMessage></MyMessage>,
    meta: {
      title: "我的消息",
    },
  },
  {
    path: "/my/message/detail",
    element: <MyMessageDetail></MyMessageDetail>,
    meta: {
      title: "消息详情",
    },
  },
];

/************************ 设置 *********************************/

export const SetRoutes: RouteRawState[] = [
  {
    path: "/set",
    element: <Set></Set>,
    meta: {
      title: "设置",
    },
  },
  {
    path: "/set/bind/bank/card",
    element: <SetBindBankCard></SetBindBankCard>,
    meta: {
      title: "绑定银行卡",
    },
  },
  {
    path: "/set/bind/bank/card/confirm",
    element: <SetBindConfirm></SetBindConfirm>,
    meta: {
      title: "确定绑定",
    },
  },
  {
    path: "/set/change/password",
    element: <SetChangePassword></SetChangePassword>,
    meta: {
      title: "修改密码",
    },
  },
  {
    path: "/set/choose/gender",
    element: <SetChooseGender></SetChooseGender>,
    meta: {
      title: "选择性别",
    },
  },
  {
    path: "/set/invite/friends",
    element: <SetInviteFriends></SetInviteFriends>,
    meta: {
      title: "邀请好友",
    },
  },
  {
    path: "/set/my/physical/signs",
    element: <SetMyPhysicalSigns></SetMyPhysicalSigns>,
    meta: {
      title: "我的体征",
    },
  },
  {
    path: "/set/realname/authentication",
    element: <SetRealNameAuthentication></SetRealNameAuthentication>,
    meta: {
      title: "实名认证",
    },
  },
  {
    path: "/set/screen/brightness",
    element: <SetScreenBrightness></SetScreenBrightness>,
    meta: {
      title: "屏幕亮度",
    },
  },
  {
    path: "/set/nickname",
    element: <SetNickname></SetNickname>,
    meta: {
      title: "设置昵称",
    },
  },
  {
    path: "/set/version/detection",
    element: <SetVersionDetection></SetVersionDetection>,
    meta: {
      title: "版本更新",
    },
  },
  {
    path: "/set/view/authentication/information",
    element: <ViewAuthenticationInformation></ViewAuthenticationInformation>,
    meta: {
      title: "查看认证信息",
    },
  },
  {
    path: "/set/view/bank/cards",
    element: <SetViewBankCards></SetViewBankCards>,
    meta: {
      title: "查看银行卡信息",
    },
  },
  {
    path: "/set/person/infomation",
    element: <PersonInfomation></PersonInfomation>,
    meta: {
      title: "个人信息页面",
    },
  },
];

/************************ 聊天 *********************************/
const Chat = React.lazy(() => import('../views/chat'))
const Login = React.lazy(() => import('../views/chat/login'))
const ChatRoutes = [{
  path: "/chat/robot",
  element: <Chat></Chat>,
  meta: {
    title: "机器人聊天",
  },
},{
  path: "/chat/login",
  element: <Login></Login>,
  meta: {
    title: "AI登录",
  },
}]
/************************ 总路由表 *********************************/

const RoutesList: RouteRawState[] = ([] as RouteRawState[]).concat(
  HomeRoutes,
  consultationRoutes,
  walletRoutes,
  patientCircleRoutes,
  VideoRoutes,
  MyRoutes,
  SetRoutes,
  ChatRoutes
);

console.log("路由个数", RoutesList.length, RoutesList);
export default RoutesList;
